/**
 * Created with IntelliJ IDEA.
 * Description:Java小作业
 * User:lenovo
 * Date:2024-04-27
 * Time:23:09
 */

//一编写一个程序，数一下1~100中出现了多少次数字9
public class Test {
    public static void main(String[] args) {
        int count=0;
        for (int i = 1; i <=100 ; i++) {
            int num=i;
            while(num>0){
                if(num%10==9){
                    count++;
                }
                num/=10;
            }
        }
        System.out.println("1~100中出现数字9的次数"+count);
    }
}
